//
//  TCUXMLTree.h
//  TreeMenuTest
//
//  Created by Etienne on 12/07/07.
//  Copyright (c) 2007 Etienne Samson. All rights reserved.
//

#import <Cocoa/Cocoa.h>

#import "TCUTree.h"
#import "TCUXMLParser.h"
#import "TCUXMLNode.h"


extern NSString* const NSXMLTreeErrorDomain;

@interface TCUXMLTree : TCUTree {
}

+ (id) xmlTreeWithNode:(TCUXMLNode*)node;

/*" High level parser interface "*/
+ (id) xmlTreeWithURL:(NSURL*)url options:(TCUXMLParserOption)options;
+ (id) xmlTreeWithData:(NSData*)data options:(TCUXMLParserOption)options;


/*"Generating a tree ready to have xml elements added"*/
+ (id) treeForStandaloneXMLDocumentWithURL: (NSURL*) url
                                  encoding: (NSStringEncoding) encoding
                                   version: (float) xmlVersion;
+ (id) treeForXMLDocumentWithURL: (NSURL*) url
                        encoding: (NSStringEncoding) encoding
                         version: (float) xmlVersion
                          dtdURL: (NSURL*) dtdUrl
                         dtdRoot: (NSString*) dtdRoot
                   dtdPublicName: (NSString*) dtdPublicName;

/*"Initializers"*/
- (id) initWithNode:(TCUXMLNode*)node;

- (id) initWithURL:(NSURL*)url;
- (id) initWithURL:(NSURL*)url parserOptions:(TCUXMLParserOption)options;

- (id) initWithData:(NSData*)data;
- (id) initWithData:(NSData*)data parserOptions:(TCUXMLParserOption)options;

- (id) initWithData:(NSData*)data error:(NSError**)error;


/*" Generating xml output from a tree "*/
- (NSData*)xmlData;
/*" Accessing the node inside this tree "*/
- (TCUXMLNode*)node;

/*"Adding xml elements to a tree"*/
- (void) addXMLChild: (TCUXMLTree*) node;
- (void) addXMLChild: (TCUXMLTree*) node atIndex: (unsigned) index;

- (NSArray*) childTreesReferencingXMLNodesOfType: (TCUXMLNodeType) type;
@end
